package com.shengwei.truck.driver.vm;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

import com.shengwei.truck.driver.model.DataSource;
import com.shengwei.truck.driver.model.Repository;

/**
 * 首页底部地图TAB页的VM层，调用M层去获取数据，同时更改liveData的数据，从而View层（LoginActivity)就能观察到LiveData数据的
 * 变化，最后更新UI。
 */
public class MapViewModel extends BaseViewModel {
    private MutableLiveData<String> mText;
    private Repository mRepository; //M层引用
    public MapViewModel(Repository repository) {
        mText = new MutableLiveData<>();
        mText.setValue("百度地图");
        mRepository = repository;
    }
    public LiveData<String> getText() {
        return mText;
    }

    public MapViewModel() {
        mRepository = Repository.getInstance(DataSource.getSingleInstance());
    }
}